<template>
  <div>
    <!--<div style="padding:0.5rem 0 ;background: white;">-->
    <!--<h1 class=" cjy-classify_title">-->
    <!--<span-->
    <!--style="display:inline-block;max-width: 12rem;line-height: 1rem;font-size: 0.6rem">活动时间： {{translateDate(activityStartTime) + ' 至 ' + translateDate(activityEndTime)}}</span>-->
    <!--</h1>-->
    <!--<p>{{remark || ''}}</p>-->
    <!--</div>-->
    <regular-meal-list :item="item"
                       v-for="(item,index) in regularPackageList" :key="index"
                       :acticeTime="acticeTime"
                       :regularPackageList="item">
    </regular-meal-list>
    <page-foot></page-foot>
  </div>
</template>

<script>
  import RegularMealList from "@/real-components/RegularMealList";
  import PageFoot from '@/real-components/PageFoot'
  import {mapGetters} from "vuex";
  import {getPageTree, initDomTree} from "../../../utils/getPageTree";
  import axios from "axios";
  import activeTime from '@/real-components/ActiveTime'
  export default {
    name: 'hello',
    data() {
      return {
        msg: '这是首页',
        page: "home",
        componentName: "HomeFirstClassification",
        activityName: '',
        recomendData: [],
        countLength: 0,
        remark: '',
        regularPackageList: [],
        activityStartTime: '',
        activityEndTime: '',
      }
    },
    components: {
      RegularMealList,
      activeTime,
      PageFoot
    },
    props: {
      regularInfo: {
        type: Object,
        default: () => {
        },

      }
    },
    created () {
      this._initPage()
    },
    computed: {
      acticeTime() {
        return this.translateDate(this.activityStartTime) + ' 至 ' + this.translateDate(this.activityEndTime)
      }
    },

    methods: {
      _initPage() {
        var data = this.regularInfo
        this.regularPackageList = data.regularPackageList  //活动详情
        this.activityStartTime = data.activityStartTime //活动开始时间
        this.activityEndTime = data.activityEndTime // 活动结束时间
        this.activityName = data.activityName  //活动 名称
        this.remark = data.remark
      },
      translateDate (data) {
        if (!data) {
          return '暂无'
        }
        return data.split(' ')[0]
      }

    },
    mounted() {
    },
    updated() {
      this.$nextTick(
        () => {
          this.$emit('refresh')
        }
      )
    }
  }
</script>

<style scoped>

  .cjy-classify_title {
    display: inline-block;
    position: relative;
    height: auto;
    width: auto;
    font-size: 0.76rem;
    font-weight: 600;
    color: #ea2f1c;
    vertical-align: middle
  }

  .cjy-classify_title::before, .cjy-classify_title::after {
    content: '';
    height: 1px;
    position: absolute;
    top: 50%;
    width: 1rem;
    background: #ea2f1c;
    display: inline-block;
  }

  .cjy-classify_title::before {
    left: -1.5rem;
  }

  .cjy-classify_title::after {
    right: -1.5rem;
  }
</style>
